package me.shurufa.activities;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.Bind;
import de.greenrobot.event.EventBus;
import me.shurufa.R;
import me.shurufa.event.EventObject;
import me.shurufa.utils.Constants;

/**
 * 添加书摘 书本完成页面 点击完成需要通知书架页刷新 书本信息页面关闭
 *
 * @FileName: me.shurufa.activities.AddBookCompleteActivity.java
 * @author: kHRYSTAL
 * @email: 723526676@qq.com
 * @date: 2016-02-04 00:06
 */
public class AddDigestCompleteActivity extends BaseActivity implements View.OnClickListener {

    @Bind(R.id.left_text)
    TextView leftText;
    @Bind(R.id.right_image)
    ImageView rightImage;
    @Bind(R.id.right_text)
    TextView rightText;
    @Bind(R.id.toolbar_divider)
    View toolbarDivider;
    @Bind(R.id.has_save)
    TextView hasSave;
    @Bind(R.id.toast_text)
    TextView toastText;
    @Bind(R.id.go_shelves)
    Button goShelves;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        activity_layout_res = R.layout.activity_add_digest_complete;
        super.onCreate(savedInstanceState);
        uiInit();
    }

    private void uiInit() {
        backInToolbar.setVisibility(View.GONE);
        titleTextView.setText(getString(R.string.make_digest));
        goShelves.setOnClickListener(this);
        String bookName = getIntent().getStringExtra(Constants.ARG_BOOK_TITLE);
        if (!TextUtils.isEmpty(bookName))
            toastText.setText(getString(R.string.book_left)+bookName+getString(R.string.book_right));
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.go_shelves:
                EventBus.getDefault().post(new Intent(Constants.ACTION_ADD_DIGEST_COMPLETE));
                finish();
                break;
        }
    }
}
